Skip to content

Parse creatable_vgpu_types in the format the driver emits - #327

Closed
yummybomb wants to merge 1 commit into
hypeship/vendor-vfio-vgpufrom
hypeship/fix-creatable-vgpu-types-parse
Closed

Parse creatable_vgpu_types in the format the driver emits#327
yummybomb wants to merge 1 commit into
hypeship/vendor-vfio-vgpufrom
hypeship/fix-creatable-vgpu-types-parse

Conversation

@yummybomb

Copy link
Copy Markdown
Contributor

Summary

Stacked on #321. Validated against an L40S host running vGPU Manager 580.159.01 on Ubuntu 24.04 / kernel 6.8, where the vendor VFIO framework is active and /sys/class/mdev_bus has no parents.

creatable_vgpu_types is a table with a header row and the type ID first:

ID    : vGPU Name
1145  : NVIDIA L40S-1B
1147  : NVIDIA L40S-1Q
...

The parser expected the name first and the ID last, so every line failed strconv.Atoi on the trailing word:

ListGPUProfilesWithVFs: n=0 err=parse vGPU type ID "Name": strconv.Atoi: parsing "Name": invalid syntax

listProfiles propagates that error, getVGPUStatus swallows it, and the host reports vGPU mode with 64 slots and zero profiles — so no vGPU placement can ever succeed.

Parsing on the : separator and skipping the header row fixes it. On the same host, profile enumeration now returns all 30 L40S types with correct framebuffer sizes.

There is a second case worth locking in: once a profile consumes a GPU's entire framebuffer, the remaining VFs on that GPU print the header and nothing else. That is a legitimately empty list, not a malformed file, so it now yields zero profiles rather than an error — otherwise a single 48Q allocation would take the whole GPU's remaining capacity out of the status response.

Tests

  • Updated the fixture to the real sysfs format and added a header-only case.
  • go test ./lib/devices/... passes.
  • Verified live: 30 profiles enumerated, availability drops from 64 to 32 slots after allocating a 48Q on one GPU, and back to 64 after release.

The driver prints an "ID : vGPU Name" table, so the previous
name-then-ID parse rejected every line and no profiles were
enumerated. A GPU with no framebuffer left prints only the header,
which now yields zero profiles instead of an error.
@yummybomb

Copy link
Copy Markdown
Contributor Author

Folded into #321 directly — the parser fix and its live validation are documented in that PR's description.

@yummybomb yummybomb closed this Jul 30, 2026
@yummybomb
yummybomb deleted the hypeship/fix-creatable-vgpu-types-parse branch July 30, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant